/*
 * @Author: wangzhongjie
 * @Date: 2020-01-08 14:33:09
 * @LastEditors  : wangzhongjie
 * @LastEditTime : 2020-01-08 14:56:10
 * @Description:菜单关闭状态
 * @Email: UvDream@163.com
 */
import React, { createContext, useReducer } from "react";

export const MenusContext = createContext({});

export const MenusStatus = props => {
  const [closed, dispatch] = useReducer(reducer, false);
  return (
    <MenusContext.Provider value={{ closed, dispatch }}>
      {props.children}
    </MenusContext.Provider>
  );
};
const reducer = (state, action) => {
  console.log(action);
  switch (action.type) {
    case "CLOSED":
      return action.closed;
    default:
      return state;
  }
};
